<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>修改商家信息</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

	<body>
		<form id="my_form"  class="layui-form update_form" action="" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">商家名称</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="agent_name" value="{$data.agent_name|default='0'}" lay-verify="required" placeholder="输入商家名称" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">*商家logo</label>
				<div class="layui-input-block" style="padding-left: 100px;">
					<img src="{$data.logo}" id="thumb_img" style="height: 150px;width: 250px;" onclick="$('input[id=file]').click();"/>
					<input type="hidden" name="logo" value="{$data.logo}" id="thumb" />
					<input onchange="UploadFile('goods',200)" type="file" accept="image/*" id="file" name="file"  style="display: none;">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">店铺性质</label>
				<div class="layui-input-block" style="float: left; margin-right: 20px; margin-left: 0;">
					<select name="agent_property" id='agent_property' lay-verify="required" lay-filter="sel_1">
						<option value="1" {if $data.agent_property == 1}selected="selected"{/if}>个人</option>
						<option value="2" {if $data.agent_property == 2}selected="selected"{/if}>企业</option>
						<option value="3" {if $data.agent_property == 3}selected="selected"{/if}>个体户</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商家地址</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="address" value="{$data.address|default='0'}" lay-verify="required" placeholder="输入商家地址" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item update_btnbox" style="text-align: center;margin-left:unset">
			<input name="id" value="{$data.id}" type="hidden">
				<div class="layui-input-block" style="max-width: unset;float: unset;">
					<button  id='change_but' class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>
</html>
<script type="text/javascript" src="__PUBLIC__/static/js/image.zip.js"></script>
<script>
function set_content(){
	 $.ajax({
         	type:"post",
            url:"{:url('index/info')}",
            data: $('#my_form').serialize(),
            success:function(data){
                if(data.code==200){
                	layer.msg(data.msg, {
					  icon: 1,
					  time: 1500 
					}, function(){
						window.parent.location.reload();
						var index = parent.layer.getFrameIndex(window.name);
				       	parent.layer.close(index); 
					});
                }else{
                	layer.msg(data.msg);
                }
            },error:function(data){
            	var a = data;
            }
    });
	
}
//图片上传
layui.use(['form'], function(){
	var $ = layui.jquery,form = layui.form;
  	//监听提交
	form.on('submit(demo1)', function(data){
		$('#change_but').addClass("layui-btn-disabled");
		set_content();
		return false;
	});
})
</script>
